﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Runtime.Serialization;

namespace Library.Models
{
    [DataContract]
    public class User
    {
        public User()
        {
            CreatedOn = DateTime.Now;
        }

        [DataMember]
        [Description("Login")]
        public string Login { get; set; }

        [DataMember]
        [Description("Hasło")]
        public string Pass { get; set; }

        [DataMember]
        [Description("Rola w systemie")]
        public int Role { get; set; }

        [DataMember]
        [Description("Imię")]
        public string Name { get; set; }

        [DataMember]
        [Description("Utworzony")]
        public DateTime CreatedOn { get; set; }

        public override string ToString()
        {
            return "Login: " + Login + ", Pass: " + Pass + ", Name: " + Name + ", Role " + (UserRole) Role;
        }
    }


    [DataContract]
    public class UserList
    {
        public UserList()
        {
            List = new List<User>();
        }

        [DataMember]
        public List<User> List { get; set; }
    }

    public enum UserRole
    {
        Admin = 1,
        User = 2,
        Viewer = 3
    }
}